# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-cybox
pkgname=('python2-cybox' 'python-cybox')
_pkgname=cybox
pkgver=2.1.0.21
pkgrel=5
epoch=1
pkgdesc='A Python library for parsing and generating CybOX 2.1.0 content.'
arch=('any')
url='https://github.com/CybOXProject/python-cybox'
makedepends=('python2-setuptools' 'python-setuptools')
license=('BSD')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('9850e0bf21314626301c862fd97f32745fa053a1f85fa7d0e3ec9c832714a5cd778a1727e2700c83f19350058695d2b865b4aca4fa1f48e3169524916f32684a')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-cybox() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-cybox() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

